﻿@using ZBJF.Warranty.WebProvider
@using ZBJF.Warranty.Common.Enums.InsuranceWarranty
@using EnumHelper = ZBJF.Warranty.Common.Common.EnumHelper
@{
    ViewBag.Title = "Index";
}
@section Header{
    @Scripts.Render("~/bundles/datatable")
    @Styles.Render("~/Content/datatable")
}
<ul class="nav nav-tabs">
    <li class="active"><a href="/AuditProjectConfigurationIndex/">审核项目列表</a></li>
    <li class="Add-R"><a href="/AuditProjectConfiguration/AuditProjectConfigurationEdit/0">添加审核项目</a></li>
</ul>
<form id="searchForm" class="breadcrumb form-search">
    <div>
        <label>审核项目类型：</label>
        @Html.DropDownList("AuditProjectWithType", ConvertToSelector.Instance.EnumTypeConvertToSelectList(typeof(AuditProjectTypeEnum)))
        <input id="btnSubmit" class="btn btn-primary Search-R" type="button" value="查询" onclick="search();">
    </div>
</form>
<div class="table-responsive dataTables_wrapper">
    <table id="auditProjectConfigurationList" class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th width="20">序号</th>
                <th width="100">审核项目类型</th>
                <th width="100">信息审核项目</th>
                <th width="100">字段类型</th>
                <th width="80">是否启用</th>
                <th width="100">操作</th>
            </tr>
        </thead>
    </table>
</div>
@section scripts{
    @Scripts.Render("~/Bundles/ImagePreview")
    <script type="text/javascript">
        var isSearch = false;
        $(function () {
            var objTable = $("#auditProjectConfigurationList")
                .dataTable({
                    fnDrawCallback: function () {
                        ControlPermissionOperate();
                    },
                    aaSorting:[[1,"asc"]],
                    "sAjaxSource": "/AuditProjectConfiguration/AuditProjectConfigurationList",
                    aoColumns: [
                        {
                            "mData": null, "bSortable": false, "fnRender": function (nRow) {
                                return nRow.iDataRow + 1;
                            }
                        },
                        { "mData": "AuditProjectType", "mDataProp": "AuditProjectWithType" },
                        {
                            "mData": "ProjectName", "fnRender": function (nRow) {
                                return "<a class='Edit-R' href='/AuditProjectConfiguration/AuditProjectConfigurationEdit/" + nRow.aData.ID + "' title='edit'>" + nRow.aData.ProjectName + "</a>";
                            }
                        },
                        { "mData": "FieldTypeName", "bSortable": false },
                         { "mData": "IsAvailable" },
                        { "mData": "ID" }
                    ],
                    "fnRowCallback": function (nRow, aData, iDisplayIndex) {
                        $('td:eq(4)', nRow).html(aData.IsAvailable ? bootStrapOkIncon : bootStrapRemoveIncon);
                        var html = "<a class='Edit-R' href='/AuditProjectConfiguration/AuditProjectConfigurationEdit/" + aData.ID + "' title='edit'><i class='icon-edit'></i></a>";
                        html += "<a class='Edit-R' href=\"javascript:UpdateStatus('" + aData.ID + "'," + !aData.IsAvailable + ",'/AuditProjectConfiguration/UpdateStatus','auditProjectConfigurationList')\" title='" + (aData.IsAvailable ? "禁用" : "启用") + "'>" + (aData.IsAvailable ? bootStrapRemoveIncon : bootStrapOkIncon) + "</a>";
                        $('td:eq(5)', nRow).html(html);
                    }
                });
            imgPreview();
        });

        function imgPreview() {
            setTimeout(function () { $("img.preview").preview(); }, 500);
        }
        function search() {
            /*给查询对象赋值*/
            queryParamList.AuditProjectWithType = ($("#AuditProjectWithType").val()).trim();
            $("#auditProjectConfigurationList").dataTable().fnDraw();
            imgPreview();
        }

    </script>
}


